//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifndef _UXS_LIBC_CMEM_H
#define _UXS_LIBC_CMEM_H

#pragma once

extern "C"
{

_CRT_JIT_INTRINSIC UX_NO_ALIAS UX_RESTRICT
	void * __CDECL calloc(size_t _Count, size_t _Size);

UX_NO_ALIAS
	void   __CDECL free(void * _Memory);

_CRT_JIT_INTRINSIC UX_NO_ALIAS UX_RESTRICT
	void * __CDECL malloc(size_t _Size);

UX_NO_ALIAS UX_RESTRICT
	void * __CDECL realloc(void * _Memory, size_t _NewSize);


#if !defined( PLATFORM_ANDROID )

UX_NO_ALIAS
	void   __CDECL _aligned_free(void * _Memory);

UX_NO_ALIAS UX_RESTRICT
	void * __CDECL _aligned_malloc(size_t _Size, size_t _Alignment);


inline UX_NO_ALIAS
	void   __CDECL _mm_free(void * _Memory)	{ return _aligned_free(_Memory); }

inline UX_NO_ALIAS UX_RESTRICT
	void * __CDECL _mm_malloc(size_t _Size, size_t _Alignment)	{ return _aligned_malloc(_Size, _Alignment); }

#endif


void *  __CDECL memcpy(void * _Dst, const void * _Src, size_t _Size);
void *  __CDECL memmove(void * _Dst, const void * _Src, size_t _Size);
void *  __CDECL memset(void * _Dst, int _Val, size_t _Size);
int     __CDECL memcmp(const void * _Buf1, const void * _Buf2, size_t _Size);



int     __CDECL strcmp(const char * _Str1, const char * _Str2);
size_t  __CDECL strlen(const char * _Str);

_CRT_JIT_INTRINSIC int    __CDECL atoi(const char *_Str);
long   __CDECL atol(const char *_Str);
double  __CDECL atof(const char *_String);

#ifdef COMPILER_MSVC
__INT64 __CDECL _atoi64(const char * _String);
#endif

#ifdef COMPILER_GCC
__INT64 __CDECL atoll(const char * _String);
#endif

int sprintf ( char * str, const char * format, ... );

}	// extern "C"


#endif	// _UXS_LIBC_CMEM_H